chabokpush / chabok-demo-android

Android demo application using Chabok push service
5 stars 4 forks source link

E/com.adpdigital.push.AdpPushClient: Cannot save device, Reason: UnknownHostException exception #11

Closed farzin680 closed 6 years ago

farzin680 commented 6 years ago

Hi There,

I've Did Done Everything In Your Android Documentation For Push Notification. But When Running The Application , I Face This Problem In LogCat :

E/com.adpdigital.push.AdpPushClient: Cannot save device, Reason: UnknownHostException exception: Unable to resolve host "com.parsdigit.helsa.push.adpdigital.com": No address associated with hostname java.io.IOException: UnknownHostException exception: Unable to resolve host "com.xxx.xxx.push.adpdigital.com": No address associated with hostname

behrad commented 6 years ago

com.parsdigit.helsa.push.adpdigital.com

We have no such host in our SDK. What changes have you made?

farzin680 commented 6 years ago

Actually Nothing,

I Think All Changes Made In Manifest : Beware That "Company Name" and "Product Name" are Replaced By "xxx" and are Not Real. Beware That "Google API Key" is Replaced By "zzz" and Not Real.

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.xxx.xxx">

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />

<permission
    android:name="com.xxx.xxx.permission.C2D_MESSAGE"
    android:protectionLevel="signature"/>

<uses-permission android:name="com.xxx.xxx.permission.C2D_MESSAGE" />

<uses-feature android:name="android.hardware.camera" />

<application
    android:name="com.xxx.xxx.HelsaApp"
    android:allowBackup="true"
    android:exported="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:launchMode="singleInstance"
    android:screenOrientation="portrait"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="com.parsdigit.helsa.provider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/provider_paths" />
    </provider>

    <provider
        android:name=".Utils.OpenFileProvider"
        android:authorities="open_file_provider"
        android:exported="true"
        android:grantUriPermissions="true"
        android:multiprocess="true" />

    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="zzz" />
    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

    <meta-data
        android:name="com.onesignal.NotificationOpened.DEFAULT"
        android:value="DISABLE" />

    <activity
        android:name="xxx.xxx.xxx.Activity.Main"
        android:launchMode="singleTop"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"
        android:windowSoftInputMode="stateHidden|adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:host="payment.xxx.co"
                android:scheme="hls" />
            <data
                android:host="wallet.xxx.co"
                android:scheme="hls" />
            <data
                android:host="invoice.xxx.co"
                android:scheme="hls" />
            <data
                android:host="premium.xxx.co"
                android:scheme="hls" />
            <data
                android:host="gift.xxx.co"
                android:scheme="hls" />
        </intent-filter>
    </activity>

    <receiver
        android:name="xxx.xxx.xxx.Utils.IncomingSms"
        android:enabled="true"
        android:exported="true"
        android:permission="android.permission.READ_SMS">
        <intent-filter android:priority="2147483647">
            <action android:name="android.provider.Telephony.SMS_RECEIVED" />
        </intent-filter>
    </receiver>

    <receiver android:name=".Services.GPSListener">
        <intent-filter>
            <action android:name="android.location.PROVIDERS_CHANGED" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </receiver>

    <service
        android:name="xxx.xxx.xxx.Services.SMSService"
        android:exported="false" />

    <receiver
        android:name="com.adjust.sdk.AdjustReferrerReceiver"
        android:permission="android.permission.INSTALL_PACKAGES"
        android:exported="true" >
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>

    <receiver android:name=".PushNotification.NotificationReceiver">
        <intent-filter>
            <category android:name="com.xxx.xxx"/>
            <action android:name="com.adpdigital.push.client.MSGRECEIVE"/>
        </intent-filter>
    </receiver>

    <receiver
        android:name="com.google.android.gms.gcm.GcmReceiver"
        android:enabled="true"
        android:exported="true"
        android:permission="com.google.android.c2dm.permission.SEND">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
            <category android:name="com.xxx.xxx" />
        </intent-filter>
    </receiver>

</application>

behrad commented 6 years ago

Are you modifing this repo? or adding chabok SDK in your own android app?

farzin680 commented 6 years ago

Just Added Chabok SDK Into My Application Code (Gradle File)

behrad commented 6 years ago

it seems you are using com.parsdigit.helsa as your appId in your Chabok initialization code. Secondly, please make sure you are configuring for the correct environment. I mean your development mode should be TRUE if you have not requested a production account

farzin680 commented 6 years ago

I think I Got The Problem ! My Sender ID In Firebase Is : My Package Name Is : com.parsdigit.helsa

In Initialization I Set The APPID Value Like This and Above Error Appears :

chabok = AdpPushClient.init(
                    getApplicationContext(),
                    Main.class,
                    "com.parsdigit.helsa/XXXXXXXXXXXXXX",

But When I set AppID Name From APPID Provided In Panel "ecgibriz" :

chabok = AdpPushClient.init(
                    getApplicationContext(),
                    Main.class,
                    "ecgibriz/XXXXXXXXXXXXXX",

Following Error Appears In Another Shape With Same Format :

E/com.adpdigital.push.AdpPushClient: Cannot save device, Reason: UnknownHostException exception: Unable to resolve host "ecgibriz.push.adpdigital.com": No address associated with hostname java.io.IOException: UnknownHostException exception: Unable to resolve host "ecgibriz.push.adpdigital.com": No address associated with hostname

behrad commented 6 years ago

You seem not to have a production chabok account, As I mentioned before please set devMode to TRUE