Skip to content

Commit

Permalink
Update SDK to version 1.2.0 and implement new features
Browse files Browse the repository at this point in the history
  • Loading branch information
MahdiHoseiniTabar committed Sep 3, 2019
1 parent 3ec42c0 commit d721f9c
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 34 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.najva.sdk:najva-android-sdk:1.1.4'
implementation 'com.najva.sdk:najva-android-sdk:1.2.0'
}
29 changes: 28 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,48 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.najvaandroidsdksample">


<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:name=".MyApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<receiver
android:name=".ClickEventReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="com.najva.sdk.Najva.ACTION_CLICK_RECEIVED" />
</intent-filter>

</receiver>
<receiver
android:name=".NotificationEventReceiver"
android:enabled="true"
android:exported="false" >
<intent-filter>
<action android:name="com.najva.sdk.Najva.ACTION_NOTIFICATION_RECEIVED"/>
</intent-filter>
</receiver>

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.najva.sdk.metadata.API_KEY"
android:value="4647ae37-f35b-40fe-94d7-c27dea3b366e" />
<meta-data
android:name="com.najva.sdk.metadata.WEBSITE_ID"
android:value="6087" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.example.najvaandroidsdksample;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.najva.sdk.Najva;

public class ClickEventReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.i("NajvaReceiver", "onReceive: " + intent.getIntExtra(Najva.BUTTON_ID,-1) +
", " +
intent.getStringExtra(Najva.MESSAGE_ID));
// You can interactive with google analytics here
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import android.os.Bundle;
import android.util.Log;

import com.najva.najvasdk.Class.Najva;
import com.najva.najvasdk.Class.NajvaJsonDataListener;
import com.najva.najvasdk.Class.NajvaUserHandler;
import com.najva.sdk.Najva;
import com.najva.sdk.NajvaJsonDataListener;
import com.najva.sdk.UserSubscriptionListener;

public class MainActivity extends AppCompatActivity {

Expand All @@ -19,17 +19,23 @@ protected void onCreate(Bundle savedInstanceState) {



Najva.initialize(this, YOUR_CAMPAIGN_ID_GOES_HERE, YOUR_WEBSITE_ID_GOES_HERE, YOUR_API_KEY_GOES_HERE);

Najva.setUserHandler(new NajvaUserHandler(){
Najva.initialize(this);
Najva.setUserSubscriptionListener(new UserSubscriptionListener() {
@Override
public void najvaUserSubscribed(String token) {
Log.i(TAG, "najvaUserSubscribed: " + token);
public void onUserSubscribed(String s) {
Log.i(TAG, "onUserSubscribed: " + s);
}
});
Log.i(TAG, "onCreate: " + Najva.getSubscribedToken(this));

//handel token
Najva.setNajvaJsonDataListener(new NajvaJsonDataListener() {
@Override
public void onReceiveJson(String s) {
Log.i(TAG, "onReceiveJson: " + s);
}
});

Najva.getCachedJsonData(this);

}
}
23 changes: 0 additions & 23 deletions app/src/main/java/com/example/najvaandroidsdksample/MyApp.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.example.najvaandroidsdksample;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.najva.sdk.Najva;

public class NotificationEventReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.i("NajvaReceiver", "onReceive: " + intent.getStringExtra(Najva.MESSAGE_ID));
// You can interactive with google analytics here
}
}

0 comments on commit d721f9c

Please sign in to comment.