How can i solve this gcm error? - google-cloud-messaging

Please, I don't know where is the problem. My onReceive function doesn't work. The GmIntentService extend WakefulBroadcastReceiver... so the onReceive is not called! Here is my code (manifest) : if someone can help me......
package="list.test.com.testnotification">
<!-- Permission -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission andr`enter code here`oid:name="android.permission.VIBRATE" />
<permission
android:name="list.test.com.testnotification.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="list.test.com.testnotification.permission.C2D_MESSAGE" />
<!-- -->
Thanks in advance!

Related

My webview application is not showing notification popup

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.gonative.android"
android:versionName="1.0.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<!-- WebRTC Audio and Video -->
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.CAMERA"/>
<!--<uses-permission android:name="android.permission.BLUETOOTH" />-->
<!--<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />-->
<!-- permissions for push messages -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<!-- permissions to block phone calls -->
<!--<uses-permission android:name="android.permission.READ_CONTACTS" />-->
<!--<uses-permission android:name="android.permission.READ_CALL_LOG" />-->
<!--<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />-->
<application
android:name=".GoNativeApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:logo="#drawable/ic_actionbar"
android:theme="#style/GoNativeTheme.NoActionBar"
android:supportsRtl="true"
android:networkSecurityConfig="#xml/network_security_config"
android:requestLegacyExternalStorage="true">
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="${admob_app_id}"/>
<activity
android:name="io.gonative.android.MainActivity"
android:label="#string/app_name"
android:exported="true"
android:configChanges="orientation|screenSize"
tools:node="merge">
</activity>
<activity
android:name=".AppLinksActivity"
android:launchMode="singleTask"
android:exported="true">
<!--additional intent filters-->
<!--example: -->
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.VIEW"></action>-->
<!--<category android:name="android.intent.category.DEFAULT"></category>-->
<!--<category android:name="android.intent.category.BROWSABLE"></category>-->
<!--<data android:scheme="http"></data>-->
<!--<data android:scheme="https"></data>-->
<!--<data android:host="gonative.io"></data>-->
<!--<data android:pathPrefix="/"></data>-->
<!--</intent-filter>-->
</activity>
<!-- For file sharing without having to use external permissions. -->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/filepaths" />
</provider>
<activity
android:name=".SplashActivity"
android:exported="true"
android:theme="#style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="#drawable/ic_notification" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="#color/colorAccent" />
<meta-data
android:name="com.google.firebase.Refex channel"
android:value="Refex channel" />
</application>
</manifest>
Hello all , I have developed an android webview application for my website , everything works fine and i have published my application in playstore but the issue is my application is still not receiving any notification , it does not show message notification when it is received , I want my application to show up the notification over the top of the display.
And also i have created a notification and have given all the the permission, Further I have integrated firebase to the application so that it can receive notification .
But the thing is , the notification popup is till not showing . What can I do for this ? what should I do more to receive and display notification over the top of the display ?
Can anyone please help me to resolve this issue
My Android application should have the notification popup over the display when the message is received
Even after giving "post notification" permission and integrating firebase messaging service , the application is not showing the notification popup.

APK Launching, "Keep Stopping" Message and logcat error..? How to fix?

I apk launching after logcat show this error.
The following permissions have to be defined in the manifest.xml file when using wifi state.
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />

Start Perview failed camera in react native

I have a component that it scans a QR code.this is my code:
import QRCodeScanner from 'react-native-qrcode-scanner';
.
.
.
<QRCodeScanner
cameraType={'front'}
onRead={this.onSuccess.bind(this)} />
.
.
.
onSuccess(e) {
console.warn(e.data);
}
this is my plist and androidmanifest.xml:
<key>NSCameraUsageDescription</key>
<string>Your message to user when the camera is accessed for the first
time</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Your message to user when the photo library is accessed for the
first time</string>
<key>NSMicrophoneUsageDescription</key>
<string>Your message to user when the microsphone is accessed for the
first time</string>
androidmanifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.CAMERA" /> <uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="26" />
</manifest>
but I receive this error: Start Preview failed camera
How can I resolve that?
Thanks, advance

Duplicate Permission AndroidManifest.xml with React Native

Is it ok to have duplicate permissions in AndroidManifest.xml file?
I am trying to add in react-native-webrtc into my react-native project which requires me to add in some permissions. The initial AndroidManifest.xml file already have a list of permissions which some will be duplicated if I add in the permissions required by react-native-webrtc. Since, im on this question, does the same goes for ios?
REQUIRED TO ADD IN BY REACT-NATIVE-WEBRTC
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
ORIGINAL
<!-- These are required permissions to make the app run -->
<uses-permission android:name="com.bulbtech.hendrysocket.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- ADD PERMISSIONS HERE -->
<!-- BEGIN OPTIONAL PERMISSIONS -->
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
No, you can not duplicate permissions in AndroidManifest.xml file and if you duplicate the permission then your code gets crashed and some goes for ios

Force and lock orientation at runtime with phonegap / cordova v3.x on iOS [duplicate]

I started looking into PhoneGap yesterday and created a simple "marble" rolling around while tilting the phone. I am currently developing on Android but I want the orientation to stay as landscaping instead of moving when the phone gets spun around. Is there a way of doing this?
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.phonegap.helloworld"
android:versionCode="1"
android:versionName="1.0" >
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".App"
android:configChanges="orientation|keyboardHidden"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.phonegap.DroidGap"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden">
<intent-filter></intent-filter>
</activity>
</application>
</manifest>
Code:
package com.phonegap.helloworld;
import android.os.Bundle;
import org.apache.cordova.*;
public class App extends DroidGap {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
Have you tried this?
android:screenOrientation="portrait"
Inside the AndroidManifest.xml file, where you have declared your activity, just add the above line.
For example:
<activity
android:name=".Activity.SplashScreenActivity"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The correct way to do this for all devices is to configure config.xml
<preference name="orientation" value="portrait" />
<preference name="orientation" value="landscape" />
https://build.phonegap.com/docs/config-xml
It is very simple, you need to add android:screenOrientation="landscape" in your AndroidManifest.xml file.
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".LogUploaderActivity" android:label="Log Uploader" android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Please try this in your activity. Inside onCreate() and before setContentView.
// keeps the screen orientation in Landscape mode
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Maybe important to mention because i did not know it:
If you use the online phonegap apk converter with hydration enabled to your application, u'll have to rebuild your app completly instead of just update it. This will help you also with preferences like "orientation" or "fullscreen" !