当我添加此捆绑的依赖项时,'com.google.android.gms:play-services:12.0.1'(FirebaseInstanceIdService,FirebaseMessagingService)这两个类没有响应。
我尝试过的解决方案:
添加firebase消息依赖。
在示例应用程序中使用我的应用程序的google-services.json,通知运行正常。.
class MY_Exceptions extends CI_Exceptions{
/*
* Class constructor
*
* @return void
*/
public function __construct()
{
$this->ob_level = ob_get_level();
/* Note: Do not log messages from this constructor.*/
}
/**
* Exception Logger
*
* Logs PHP generated error messages
*
* @param int $severity Log level
* @param string $message Error message
* @param string $filepath File path
* @param int $line Line number
* @return json response
*/
public function log_exception($severity, $message, $filepath, $line)
{
/*
* default log this
* and user will get a message of server error
*/
$severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity;
log_message('error', 'Severity: '.$severity.' --> '.$message.' '.$filepath.' '.$line);
$response = array(
'status' => 'Error',
'error' => '1',
'message' => 'Server Error ! Please contact administrator !'
);
echo json_encode($response);exit;
}
/**
* 404 Error Handler
*
* @uses CI_Exceptions::show_error()
*
* @param string $page Page URI
* @param bool $log_error Whether to log the error
* @return json response
*/
public function show_404($page = '', $log_error = TRUE)
{
if (is_cli())
{
$heading = 'Not Found';
$message = 'The controller/method pair you requested was not found.';
}
else
{
$heading = '404 Page Not Found';
$message = 'The page you requested was not found.';
}
/*
* default log this
* and user will get a message of server error
*/
if ($log_error)
{
log_message('error', $heading.': '.$page);
}
$response = array(
'status' => 'Error',
'error' => '1',
'message' => $message
);
echo json_encode($response);exit;
}
/**
* General Error Page
*
* Takes an error message as input (either as a string or an array)
* and displays it using the specified template.
*
* @param string $heading Page heading
* @param string|string[] $message Error message
* @param string $template Template name
* @param int $status_code (default: 500)
*
* @return json response
*/
public function show_error($heading, $message, $template = 'error_general', $status_code = 500)
{
/*
* default log this
* and user will get a message of server error
*/
log_message( 'error', print_r($heading,true).': '. print_r($message,true) );
$response = array(
'status' => 'Error',
'error' => '1',
'message' => 'Server Error ! Please contact administrator !'
);
echo json_encode($response);exit;
}
public function show_exception($exception)
{
/*
* default log this
* and user will get a message of server error
*/
log_message( 'error', $exception->getMessage() );
$response = array(
'status' => 'Error',
'error' => '1',
'message' => 'Server Error ! Please contact administrator !'
);
echo json_encode($response);exit;
}
/**
* Native PHP error handler
*
* @param int $severity Error level
* @param string $message Error message
* @param string $filepath File path
* @param int $line Line number
* @return json response
*/
public function show_php_error($severity, $message, $filepath, $line)
{
/*
* default log this
* and user will get a message of server error
*/
$severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity;
log_message('error', 'Severity: '.$severity.' --> '.$message.' '.$filepath.' '.$line);
$response = array(
'status' => 'Error',
'error' => '1',
'message' => 'Server Error ! Please contact administrator !'
);
echo json_encode($response);exit;
}