notificationEnableDisable.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (isChecked) {
register();
} else {
unregister();
}
});
//To Turnon receiving Braze notifications in Android app...void register() {
// Need to register push notifications with current device token com.package.Appboy appboy = com.package.Appboy.getInstance(context);
String deviceToken = FirebaseInstanceId.getInstance().getToken();
if (Strings.isNonEmpty(deviceToken)) {
appboy.registerAppboyPushMessages(deviceToken);
}
}
//To Turnoff receiving Braze notifications in Android app...void unregister() {
com.package.Appboy appboy = com.package.Appboy.getInstance(context);
AppboyUser user = appboy.getCurrentUser();
if (user != null) {
user.setPushNotificationSubscriptionType("unsubscribed");
}
}
Translate
Thursday, April 30, 2020
Android code to turn-on/Enable and turn-off/Disable receiving Braze push/silent notifications in Android device
Monday, April 27, 2020
Code to add data or elements to Set Collection
About Set :
A Set is a Collection that cannot contain duplicate elements.
Java Set is an interface that extends Collection interface.
//Adding null element to Set also possible, based on that we should check for null before doing any Set operation
names.add(null);
// Adding Strings elements in Set
Set<String> names = new HashSet<>();
names.add("Pavan");
names.add("Tilak");
if (names.add("Pavan")) {
System.out.println("Pavan is added to the set");
}
if (!names.add("Tilak")) {
System.out.println("Tilak is already added to the set");
}
Tuesday, April 21, 2020
How To Fill Invalid Activity Form For Disabled Google Adsence Account
1.How do users get to your site, mobile app, and/or YouTube channel? How do you promote your content? *
Ans :
My blog has content about Android app development tips, bug fixes,leraning documents. Users reaches to my contents via google search engine include google, bing or Youtube channel and other youtube features. I promote my channel by sharing the content in Facebook, Twitter,Youtube channel, Job portals,office colleagues, students ,training institutes.
2.Have you or your site, mobile app, and/or YouTube channel ever violated the AdSense program policies or Terms & Conditions? If so, how? Also, include any relevant information that you believe may have resulted in invalid activity. *
Ans :
Dear Google,
This is the first time my Adsense invalid activity. The time adds suspended in my blog, I have less than one-year using Blogger Website and Adsense,. I respect the Google Adsense policy and terms and conditions.
I don’t encourage my friends and family to do any invalid clicks on my Blog.
From my points of view the main reason for my account revoked might be “My Competitor Might have done some invalid activities or there might be some people who don’t have proper knowledge on how to use my blog in mobile. This might be the reason for my account deactivation.
I promote my Blogger posts by sharing on social media like Facebook, WhatsApp, Instagram and YouTube but I can’t understand who are do these types of unusual activity on my Blog. Again, I promise here that I will abide by the Google Adsense policy in every step of my activity. Please Understand my Spending Time With Adsense And Re-Enable My Account.
3.What changes will you implement to help improve ad traffic quality on your site, mobile app, and/or YouTube channel? *
Ans :
First of all, I really apologize for any invalid activity and condemn like these activities and also for those mistakes which happened by unknowingly and my negligence. Further now, I assure adsense to be genuine AdSense partner. I used Adsense partnership a month and tried my best to do and valid activities.
If my Adsense is restarted I will do everything according to AdSense policies and try to get away from any invalid activity which violates any term and condition.
Please, Sir, Give Me the Last Chance I really Recommenced All The Adsense Terms And Conditions.
4.Please include any data from your site, mobile app, and/or YouTube channel traffic logs or reports that indicate suspicious IP addresses, referrers, or requests which could explain invalid activity. *
Ans :
Dear Google,
This is the first time that my AdSense account is disabled due to like this invalid clicks activity. As this incident happened on couple of years back I could not able to record my suspicious IP address, traffic log & reports. I also apologize again for this negligence too.
As must as I know about my site or AdSense I have mentioned. I only appeal to ignore any server or light invalid activity to my account and give me first and last chance to work properly on my AdSense account. I accept my mistakes which happened by unknowingly and my negligence. Requesting you , please give me one last chance .
Thanking you for your valuable time and efforts.
x
Monday, April 20, 2020
Code to Parse JSON array to Java array or list in Android/Java
[
{
"name": "Alex",
"id": 1
},
{
"name": "Brian",
"id": 2
}
]
|
public class User
{
private long id;
private String name;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "User [id=" + id + ", name=" + name + "]";
}
}
|
String userJson = "[{'name': 'Alex','id': 1}, "
+ "{'name': 'Brian','id':2}, "
+ "{'name': 'Charles','id': 3}]";
Gson gson = new Gson();
User[] userArray = gson.fromJson(userJson, User[].class);
for(User user : userArray) {
System.out.println(user);
}
|
2. List of objects
Java program to deserialize json array as root – to Java list of objects.
import java.lang.reflect.Type;
import java.util.ArrayList;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
String userJson = "[{'name': 'Alex','id': 1}, "
+ "{'name': 'Brian','id':2}, "
+ "{'name': 'Charles','id': 3}]";
Gson gson = new Gson();
Type userListType = new TypeToken<ArrayList<User>>(){}.getType();
ArrayList<User> userArray = gson.fromJson(userJson, userListType);
for(User user : userArray) {
System.out.println(user);
}
|
Program output.
User [id=1, name=Alex]
User [id=2, name=Brian]
User [id=3, name=Charles]
|
Subscribe to:
Posts (Atom)
Could not identify launch activity: Default activity not found : Error while Launching activity
Problem : I got this Error , When I tried to create an application without any Activity . Basically like to develop an Android Headless appl...
-
Audio Focus Android O – 26.0 : https://developer.android.com/guide/topics/media-apps/audio-focus.html#audio-focus-change...
-
down vote Following is the fix for AndroidStudio 3.1.2 OR Newer Versions : We have faced the same issue on AS 3.1.2 , but a simp...
-
PHP is a server side scripting language. Php is for fetching data from the datastore, perform bussiness logics, then dump the necessary htm...