Skip to content

Commit

Permalink
update the notification
Browse files Browse the repository at this point in the history
  • Loading branch information
SheikhElMoctarG committed Oct 6, 2022
1 parent dfcf659 commit 2779c81
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions app/src/main/java/com/sheikh/exe_apk/HomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.Toast;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
Expand Down Expand Up @@ -72,11 +73,6 @@ protected void onCreate(Bundle savedInstanceState) {
// load ads
//AdView adView = findViewById(R.id.adView); // ACTIVE THIS LINE TO ADD THE ADS
// loadAd(adView, this); // ACTIVE THIS LINE TO ADD THE ADS
try {
notifications();
} catch (JSONException e) {
e.printStackTrace();
}
}
// restart the info after again
public void restart() throws JSONException {
Expand Down Expand Up @@ -202,8 +198,8 @@ public void notifications(String link, String title) throws JSONException {
String notification_id = "New Posts";
Intent notificationIntent = new Intent(this, DetailsActivity.class);
// we use first post as test
notificationIntent.putExtra("url", getPostTest("link"));
notificationIntent.putExtra("title", getPostTest("title"));
notificationIntent.putExtra("url", link);
notificationIntent.putExtra("title", title);
notificationIntent.putExtra("password", new dotEnv().PASSWORD_KEY);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addNextIntentWithParentStack(notificationIntent);
Expand All @@ -225,12 +221,15 @@ public void notifications(String link, String title) throws JSONException {
NotificationManagerCompat compat = NotificationManagerCompat.from(this);
compat.notify(1, builder.build());
}
// method for test notifications only
public String getPostTest(String info) throws JSONException {
JSONObject post = posts.getJSONObject(2);
if (info == "title")
return post.getString(info);
else
return post.getString(info);
// method to active app background
@Override
protected void onStop() {
super.onStop();
Toast.makeText(getApplicationContext(), "the onstop()", Toast.LENGTH_LONG).show();
try {
notifications("https://www.exe-apk.com/2022/09/powertoys.html", "anything");
} catch (JSONException e) {
e.printStackTrace();
}
}
}

0 comments on commit 2779c81

Please sign in to comment.