This paper investigates the issue of cooperative activity detection for grant-free random access in the sixth-generation (6G) cell-free wireless networks with sourced and unsourced paradigms. First, we propose a cooperative framework for solving the problem of device activity detection in sourced random access. In particular, multiple access points (APs) cooperatively detect the device activity via exchanging low-dimensional intermediate information with their neighbors. This is enabled by the proposed covariance-based algorithm via exploiting both the sparsity-promoting and similarity-promoting terms of the device state vectors among neighboring APs. A decentralized approximate separating approach is introduced based on the forward-backward splitting strategy for addressing the formulated problem. Then, the proposed activity detection algorithm is adopted as a decoder of cooperative unsourced random access, where the multiple APs cooperatively detect the list of transmitted messages regardless of the identity of the transmitting devices. Finally, we provide sufficient conditions on the step sizes that ensure the convergence of the proposed algorithm in the sense of Bregman divergence. Simulation results show that the proposed algorithm is efficient for addressing both sourced and unsourced massive random access problems, while requires a shorter signature sequence and accommodates a significantly larger number of active devices with a reasonable antenna array size, compared with the state-of-art algorithms.