Skip to content

Instantly share code, notes, and snippets.

@rohitnotes
rohitnotes / PhpFireBaseNotificationSample.php
Created May 21, 2022 07:21 — forked from MohammadaliMirhamed/PhpFireBaseNotificationSample.php
firebase notification sample in php . if you like this code follow me and star it . i will follow you and use your codes and share them . Simple PHP FireBase (FCM) script showing how to send an Android push notification. Be sure to replace the SERVER_API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call
<?php
#API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-SERVER-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = $_GET['id'];
#prep the bundle
$msg = array
(
'body' => 'Body Of Notification',
@rohitnotes
rohitnotes / PnNetworkMonitor.java
Created September 7, 2020 23:21 — forked from frederickbrock/PnNetworkMonitor.java
networkconnectivity.java
public class PnNetworkMonitor {
private static PnNetworkMonitor instance;
private ConnectivityManager mConnectivityManager;
private Context mContext;
private final ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback(){
@rohitnotes
rohitnotes / CheckNetwork.java
Created September 7, 2020 23:20 — forked from Abhinav1217/CheckNetwork.java
Network Test on API 29 - Java
package com.example.simplenetwork;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.LinkProperties;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.util.Log;
@rohitnotes
rohitnotes / CheckNetwork.java
Created September 7, 2020 23:19 — forked from PasanBhanu/CheckNetwork.java
Check Internet Connection in Android (API Level 29) Using Network Callback
/*
You need to call the below method once. It register the callback and fire it when there is a change in network state.
Here I used a Global Static Variable, So I can use it to access the network state in anyware of the application.
*/
// You need to pass the context when creating the class
public CheckNetwork(Context context) {
this.context = context;
}
@rohitnotes
rohitnotes / BaseAdapter.java
Created August 21, 2020 13:47 — forked from DHosseiny/BaseAdapter.java
Databinding BaseAdapter based on george mount's medium post.
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by Davud. MyApplication project.
*/
@rohitnotes
rohitnotes / RVObserver.java
Created August 21, 2020 13:46 — forked from IshankGulati/RVObserver.java
Base Adapter and RecyclerView.ViewHolder implementation for delegating clicks to Fragment to which adapter is attached. This gist is inspired from https://gist.github.com/aurae/ebf8ec212e4296aebb24 .
/**
* Created by Ishank Gulati on 14/10/16.
* Observer as per Observer design pattern.
*/
public interface RVObserver {
void update(RecyclerViewItemClickListener listener);
}
@rohitnotes
rohitnotes / BaseAdapter.java
Created August 21, 2020 13:36 — forked from andhikayuana/BaseAdapter.java
BaseRecyclerViewAdapter Android
/**
* @author Yuana andhikayuana@gmail.com
* @since Jun, Sun 10 2018 13.44
**/
public abstract class BaseAdapter<T, V extends BaseViewHolder> extends RecyclerView.Adapter<V> {
protected List<T> data = new ArrayList<T>();
protected Context context;
protected OnItemClickListener itemClickListener;
protected OnLongItemClickListener longItemClickListener;